package com.ijunfu.study.jdk.jdk8.date;

import java.time.Instant;

/**
 * @Title : Instant 时间戳示例：计算1~100之和所耗时间
 * @Remarks:
 * @Author : Weizhiguo
 * @Version: 1.0.0
 * @Date : 2022-04-30
 */
public class InstantDemo {

    public static void main(String[] args) {
        Instant start = Instant.now();

        int sum = 0;
        for(int i=1; i<=100; i++) {
            sum += i;
        }
        System.out.println(sum);

        System.out.println(Instant.now().getNano() - start.getNano());
    }
}
